package com.qidian.mes.device.service.impl;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.device.mapper.ScmsMapper;
import com.qidian.mes.device.service.ScmsService;
import com.qidian.mes.pojo.Scms;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author 刘泽磊
 * @Company 起点编程
 * @Description
 * @Time 2024/10/21 10:33
 */
@Service
public class ScmsServiceImpl implements ScmsService {
    @Autowired
    private ScmsMapper scmsMapper;
    @Override
    public MESResult select(Scms scms) {
        return MESResult.success(scmsMapper.select(scms));
    }

    @Override
    public MESResult insert(Scms scms) {
        String result = scms.getScmsFnum() + scms.getScmsFunit();
        scms.setScmsFrequency(result);
        return MESResult.success(scmsMapper.insert(scms));
    }

    @Override
    public MESResult update(Scms scms) {
        String result = scms.getScmsFnum() + scms.getScmsFunit();
        scms.setScmsFrequency(result);
        return MESResult.success(scmsMapper.update(scms));
    }

    @Override
    public MESResult selectById(Long scmsId) {
        return MESResult.success(scmsMapper.selectById(scmsId));
    }

    @Override
    public MESResult delete(Long scmsId) {
        return MESResult.success(scmsMapper.delete(scmsId));
    }

}
